<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<script type="text/javascript" src="jquery-3.1.4.js">
		</script>
		<style type="text/css">
			#div {
				text-align: center;
			}
		</style>
	</head>

	<body>
		<div id="div">
			姓名：<input type="text" id="name" /> 年龄：
			<input type="text" id="age" />
			<br>
			<input type="submit" id="submit_id" value="提交" />
		</div>
		<center>
			<div id="div2">
				<table border="1px" cellspacing="0px" cellpadding="0px" id="tb" width="200px">
					<tr>
						<td>name</td>
						<td>age</td>
					</tr>
				</table>
			</div>
		</center>
		<script type="text/javascript">
			$("input[id=submit_id]").click(function() {
				//alert($("#name").attr("type"));
				// 获取输入类型的标签值，用value获取
				var username = $("#name").val(); // 还可以用 .attr()一个参数是指 获取值 两个参数是指赋值
				var userage = $("#age").val();
				alert(userage);
				var $tr = $("<tr></tr>");
				$tr.html("<td>" + username + "</td><td>" + userage + "</td>");
				$("#tb").append($tr);
			});
		</script>
	</body>

</html>